home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / asmbler.arc / FILKQQ.INC < prev    next >
Text File  |  1988-11-19  |  5KB  |  133 lines

  1. {  IBM Personal Computer Pascal file control block  }
  2. {    Version 1.00 (C) Copyright 1981 by IBM Corp    }
  3.  
  4. INTERFACE;  UNIT 
  5.   FILKQQ (FCBFQQ, FILEMODES, SEQUENTIAL, TERMINAL, DIRECT,
  6.           DEVICETYPE, CONSOLE, LDEVICE, DISK,
  7.           DOSEXT, DOSFCB, FNLUQQ, SCTRLNTH);
  8.  
  9. CONST
  10.  
  11.   FNLUQQ = 21;        { length of a DOS filename }
  12.   SCTRLNTH = 512;    { length of a disk sector }
  13.  
  14. TYPE
  15.  
  16. DOSEXT = RECORD        { DOS file control block extension }
  17.  
  18.     PS  [0]: BYTE;    { boundary byte, not in extension }
  19.     FG  [1]: BYTE;    { flag;  must be 255 in extension }
  20.     XZ  [2]: ARRAY [0..4] OF BYTE;    { padding, internal use }
  21.     AB  [7]: BYTE;    { attribute bits }
  22.  
  23.   END;
  24.  
  25. DOSFCB = RECORD        { DOS file control block (normal) }
  26.  
  27.     DR  [0]: BYTE;    { drive number, 0=def, 1=A etc }
  28.     FN  [1]: STRING (8);    { file name - 8 bytes }
  29.     FT  [9]: STRING (3);    { file extension - 3 bytes }
  30.     EX [12]: BYTE;    { current extent, lo byte }
  31.     E2 [13]: BYTE;    { current extent, hi byte }
  32.     S2 [14]: BYTE;    { sector size, lo byte }
  33.     RC [15]: BYTE;    { sector size, hi hyte (ext sect) }
  34.     Z1 [16]: WORD;    { file size, lo word;  readonly }
  35.     Z2 [18]: WORD;    { file size, hi word;  readonly }
  36.     DA [20]: WORD;    { date, bits DDDDDMMMMYYYYYYY }
  37.     DN [16]: ARRAY [0..9] OF BYTE;    { reserved for DOS }
  38.     CR [32]: BYTE;    { current sector within extent }
  39.     RN [33]: WORD;    { direct sector number lo word }
  40.     R2 [35]: BYTE;    { direct sector number hi byte }
  41.     R3 [36]: BYTE;    { hi byte (iff sect size < 64) }
  42.     PD [37]: BYTE;    { pad to a word boundary, not DOS }
  43.  
  44.   END;
  45.  
  46. DEVICETYPE = (CONSOLE, LDEVICE, DISK);
  47.         { physical device type }
  48.  
  49. FILEMODES = (SEQUENTIAL, TERMINAL, DIRECT);
  50.         { access mode for file }
  51.  
  52. FCBFQQ = RECORD     {byte offsets start every field comment}
  53.  
  54. {fields accessible by Pascal user as <file variable>.<field>}
  55.  
  56. TRAP: BOOLEAN;      {00 Pascal user trapping errors if true}
  57. ERRS: WRD(0)..15;   {01 error status, set only by all units}
  58. MODE: FILEMODES;    {02 user file mode;  not used in unit U}
  59.  
  60. {fields shared by units F, V, U;  ERRC is write-only}
  61.  
  62. MISC: BYTE;         {03 pad to word bound, unused, reserved} 
  63. ERRC: WORD;         {04 error code, error exists if nonzero}
  64.                         {1000..1099:  set for unit U errors}
  65.                         {1100..1199:  set for unit F errors}
  66.                         {1200..1299:  set for unit V errors}
  67. ESTS: WORD;         {06 unused - reserved }
  68. CMOD: FILEMODES;    {08 system file mode;  copied from MODE}
  69.  
  70. {fields set / used by units F and V, and read-only in unit U}
  71.  
  72. TXTF: BOOLEAN;      {09 true: formatted / ASCII / TEXT file}
  73.                         {false: not formatted / binary file}
  74. SIZE: WORD;         {10 record size set when file is opened}
  75.                         {DIRECT: always fixed record length}
  76.                         {others: max length (UPPER (BUFFA))}
  77. MISB: WORD;         {12 unused - reserved }
  78. OLDF: BOOLEAN;      {14 true: must exist before open; RESET}
  79.                         {false: can create on open; REWRITE}
  80. INPT: BOOLEAN;      {15 true: user is now reading from file}
  81.                         {false: user is now writing to file}
  82. RECL: WORD;         {16 DIRECT record number, lo order word}
  83. RECH: WORD;         {18 DIRECT record number, hi order word}
  84. USED: WORD;         {20 number bytes used in current record}
  85.  
  86. {field used internally by units F and V not needed by unit U}
  87.  
  88. LINK: ADR OF FCBFQQ;{22 DS offset address of next open file}
  89.  
  90. {fields used internally by unit F not needed by units V or U}
  91.  
  92. BADR: ADRMEM;       {24 ADR of buffer variable (end of FCB)}
  93. TMPF: BOOLEAN;      {26 true if temp file;  delete on CLOSE}
  94. FULL: BOOLEAN;      {27 buffer lazy evaluation status, TEXT}
  95. MISA: BYTE;         {28 unused - reserved }
  96. OPEN: BOOLEAN;      {29 file opened; RESET / REWRITE called}
  97.  
  98. {fields used internally by unit V not needed by units F or U}
  99.  
  100. FUNT: INTEGER;      {30 Unit V's unit number always above 0}
  101. ENDF: BOOLEAN;      {32 Unit V's file-at-end operation flag}
  102.  
  103. {fields set / used by unit U, and read-only in units F and V}
  104.  
  105. REDY: BOOLEAN;      {33 reserved }
  106. BCNT: WORD;         {34 number of data bytes actually moved}
  107. EORF: BOOLEAN;      {36 true if end of record read, written}
  108. EOFF: BOOLEAN;      {37 end of file flag set after EOF read}
  109.  
  110.      {unit U (operating system) information starts here}
  111.  
  112. NAME: LSTRING (FNLUQQ);    { 38 DOS file name for this file }
  113. DEVT: DEVICETYPE;    { 60 type of device accessed by this file }
  114. RDFC: BYTE;        { 61 function code to read from a device }
  115. WRFC: BYTE;        { 62 function code to write to a device }
  116. CHNG: BOOLEAN;        { 63 true if data in sbuf was changed }
  117. SPTR: WORD;        { 64 pointer (index) into sbuf }
  118. DOSX: DOSEXT;        { 66 extended DOS file control block }
  119. DOSF: DOSFCB;        { 74 normal DOS file control block }
  120. IEOF: BOOLEAN;        {112 true if eoff should be true next get }
  121. FNER: BOOLEAN;        {113 true if a filename error has occured }
  122. SBFL: BYTE;        {114 max length of textfile line in sbuf }
  123. SBFC: BYTE;        {115 number of chars read into sbuf }
  124. SBUF: ARRAY [WRD(0)..SCTRLNTH-1] OF BYTE;    {116 sector buffer }
  125. PMET: ARRAY [0..5] OF BYTE;    {116 + sctrlnth: reserved pad }
  126.  
  127. BUFF: CHAR;        { Pascal buffer variable, (component) }
  128.  
  129.      {end of section for unit U specific OS information}
  130.  
  131. END;
  132. END;
  133.